//
//  ST_SameCityHeader.swift
//  btvideo
//
//  Created by mac on 2019/12/10.
//  Copyright © 2019 JarvanZhang. All rights reserved.
//

import UIKit
import SnapKit
import SwifterSwift

class ST_SameCityHeader: UICollectionReusableView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.backgroundColor = Color.white
        
        self.addSubview(icon_image_view)
        icon_image_view.snp.makeConstraints { (make) in
            make.width.equalTo(72/2.0)
            make.height.equalTo(80/2.0)
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(16)
        }
        self.addSubview(describe_label)
        describe_label.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(icon_image_view.snp.bottom).offset(10)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
//    MARK: - Properties
    fileprivate lazy var icon_image_view:UIImageView = {
       
        let control = UIImageView()
        control.image = ST_ImageUtils.imageName("首页_icon_锁")
        return control
    }()
    
    fileprivate lazy var describe_label:UILabel = {
       let control = UILabel()
        control.numberOfLines = 0
        control.textAlignment = .center
        return control
    }()
    
    fileprivate lazy var male_describe:NSAttributedString = {
        let attrString = NSMutableAttributedString(string: "解锁同城功能\n直接发起超级喜欢，回复率提升500%")
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 16),.foregroundColor: UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1)]
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        return attrString
    }()
    
    fileprivate lazy var female_describe:NSAttributedString = {
        let attrString = NSMutableAttributedString(string: "解锁同城功能\n无限挑选全部同城最佳男生")
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 16),.foregroundColor: UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1)]
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        return attrString
    }()
    
    var sex = ST_SEX.male{
        didSet{
            
            if sex != .female{
                describe_label.attributedText = male_describe
            }else{
                describe_label.attributedText = female_describe
            }
        }
    }
}
